﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class APP_Controls_Double_Betting : System.Web.UI.UserControl
{
    protected int m = ReadRequest.RequestInt("m"); 
    protected int type = 1;
    protected List<Model.LotteryAnnouncement> lotteryAn = null;
    protected List<Model.LotteryQs> lotterys = null;
    protected List<Model.LotteryQs> curModelLotterys = null;
    protected decimal curModelLotteryMoney = 0;
    protected decimal userbuybuyMoney = 0;
    protected List<Model.LotteryBuyDetail> userbuy = null;

    protected List<Model.LotteryAnnouncement> curModelLottery = null;
    protected decimal curModelLotteryMoneys = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        int curCount = 0;
        curModelLottery = BLL.LotteryAnnouncement.GetPageList_Where(0, 2, type, out curCount);
        if (curModelLottery != null)
        {
            //curModelLotteryMoney = bindTotal2(curModelLottery[0].LotteryQS);
            curModelLotteryMoney = curModelLottery[0].jiangChi;
        }

        int curcounts = 0;

        curModelLotterys = BLL.LotteryQs.GetPageList_Where(0, 2, type, out curCount);
        if (curModelLotterys != null)
        {
            curModelLotteryMoneys = bindTotal2(curModelLotterys[0].Lotteryqs);
        }
    }

   

    public decimal bindTotal2(string qs)
    {
        int totalCount4 = 0;
        userbuy = BLL.LotteryBuyDetail.getlistbytypeandqs(0, int.MaxValue, type, qs, out  totalCount4);
        if (userbuy != null)
        {
            for (int i = 0; i < userbuy.Count; i++)
            {
                userbuybuyMoney += userbuy[i].LotteryMoney;
            }
        }
        return userbuybuyMoney;
    }
    public string bindTotal(string qs)
    {
        int totalCount4 = 0;
        userbuy = BLL.LotteryBuyDetail.getlistbytypeandqs(0, int.MaxValue, type, qs, out  totalCount4);
        if (userbuy != null)
        {
            for (int i = 0; i < userbuy.Count; i++)
            {
                userbuybuyMoney += userbuy[i].LotteryMoney;
            }
        }
        return userbuybuyMoney / 10000 > 1 ? (userbuybuyMoney / 10000).ToString("0.00") + "万元" : userbuybuyMoney + "元";
    }
    public string bindLebelMoney(decimal money)
    {
        return money / 10000 > 1 ? (money / 10000).ToString("0.00") + "万元" : money + "元"; ;
    }
    public string bindLotteryNo(string LotteryNo)
    {
        string[] ssqflaglist = LotteryNo.Split('+');
        string[] SSQList = null;
        string[] SSQListBlue = null;
        string SSQblue = null;
        SSQList = ssqflaglist[0].Split(',');
        if (ssqflaglist.Length == 2 && SSQList.Length == 6)
        {
            SSQblue = ssqflaglist[1];
            return "<li>" + SSQList[0]
                + "</li><li>" + SSQList[1]
                + "</li><li>" + SSQList[2]
                + "</li><li>" + SSQList[3]
                + "</li><li>" + SSQList[4]
                + "</li><li>" + SSQList[5] + "</li><li class=\"last_l\">" + SSQblue + "</li>";
        }
        else if (ssqflaglist.Length == 2 && SSQList.Length == 5)
        {
            SSQListBlue = ssqflaglist[1].Split(',');
            return "<li>" + SSQList[0]
                + "</li><li>" + SSQList[1]
                + "</li><li>" + SSQList[2]
                + "</li><li>" + SSQList[3]
                + "</li><li>" + SSQList[4]
                + "</li><li class=\"last_l\">" + SSQListBlue[0] + "</li><li class=\"last_l\">" + SSQListBlue[1] + "</li>";
        }
        else if (ssqflaglist.Length == 2 && SSQList.Length == 7)
        {
            SSQblue = ssqflaglist[1];
            return "<li>" + SSQList[0]
                + "</li><li>" + SSQList[1]
                + "</li><li>" + SSQList[2]
                + "</li><li>" + SSQList[3]
                + "</li><li>" + SSQList[4]
                + "</li><li>" + SSQList[5]
                + "</li><li>" + SSQList[6] + "</li><li class=\"last_l\">" + SSQblue + "</li>";
        }
        else
        {
            string str = "<li>";
            for (int i = 0; i < SSQList.Length; i++)
            {
                str += SSQList[i] + "</li><li>";
            }
            return str.Substring(0, str.Length - 4);
        }
    }
}